package com.han.bom;

import java.util.ArrayList;

/**
 * Represents the question the Professor makes to accomplish an Exam.
 * 
 * @author Nicol Angelo A. Santos
 * @version 1.0
 * @since JDK 1.7
 */

public abstract class Question {
	
	private String questionID;
	private String question;
	private String answer;
	private String category;
	private ArrayList <String> choices;
	private static int totalNumQuestions;
		
	/**
	 * An overridden method from the Object that returns an int type and represents a Question through its Question Id.
	 * 
	 * @return
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((questionID == null) ? 0 : questionID.hashCode());
		return result;
	}
	/**
	 * An overridden method that returns a true value if the compared questions are the same. They are compared
	 * through their Question Ids.
	 * 
	 * @param obj
	 * @return
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Question other = (Question) obj;
		if (questionID == null) {
			if (other.questionID != null)
				return false;
		} else if (!questionID.equals(other.questionID))
			return false;
		return true;
	}
	/**
	 * An overridden method that returns a string consisting the Question's Id, Question and Answer.
	 * 
	 * @return
	 */
	@Override
	public String toString() {
		return "Question [questionID=" + questionID + ", question=" + question
				+ ", answer=" + answer + "]";
	}
	/**
	 * Returns the Question's Id. It is in the form of String.
	 * 
	 * @return
	 */
	public String getQuestionID() {
		return questionID;
	}
	/**
	 * Sets the Question's Id
	 * 
	 * @param questionID
	 */
	public void setQuestionID(String questionID) {
		this.questionID = questionID;
	}
	/**
	 * Returns the question for the student
	 * 
	 * @return
	 */
	public String getQuestion() {
		return question;
	}
	/**
	 * Sets the question for the student
	 * 
	 * @param question
	 */
	public void setQuestion(String question) {
		this.question = question;
	}
	/**
	 * Returns the correct answer of the question
	 * 
	 * @return
	 */
	public String getAnswer() {
		return answer;
	}
	/**
	 * Sets the correct answer of the question
	 * 
	 * @param answer
	 */
	public void setAnswer(String answer) {
		this.answer = answer;
	}
	/**
	 * Returns a static int variable that gives out the total number questions made by all professors
	 * 
	 * @return
	 */
	public static int getTotalQuestions() {
		return totalNumQuestions;
	}
	/**
	 * Sets the total number questions made by all professors
	 * 
	 * @param totalQuestios
	 */
	public static void setTotalQuestions(int totalQuestios) {
		Question.totalNumQuestions = totalQuestios;
	}
	/**
	 * Returns the question's category
	 * 
	 * @return
	 */
	public String getCategory() {
		return category;
	}
	/**
	 * Sets the category for the question
	 * 
	 * @param category
	 */
	public void setCategory(String category) {
		this.category = category;
	}
	public ArrayList <String> getChoices() {
		return choices;
	}
	public void setChoices(ArrayList <String> choices) {
		this.choices = choices;
	}
}
